//Controller 
	if($pv -> TriedToEditPost())
					{
						$html .= $pv -> EditPosts($postArray);
						echo 'goddag';
						$ph ->DoEditPost($pv->GetMessageIDEdit());
						
					}
					

//Database
	public function EditPost($id){
		$sqlEditPost = "UPDATE posts SET postID = ?";

		$stmt = $this->dbconn->prepare($sqlEditPost);
		$stmt->bind_param('i', $id);

	
			$stmt->execute();
			$stmt->store_result();
			$rows = $stmt->num_rows;
			$stmt->close();	
			
			if($rows>0){
				return true;
			}else{
				return false;
			}
	}
	

//vyn
public function DoEditPostBut($messageID) {
		$editButton = "<form method='POST'>
		<input type='hidden' value=''".$messageID."'' name='" . $this -> edit . "'/>
		<input type='submit' value='Edit'/></form>";
		return $editButton;
	}
	
public function EditPosts($postArray){
		$ret = "";
		
		$lv = new LoginView();
	
		foreach($postArray->get() as $post) {
				$messageID = $post -> getpostID();
				
				
			$ret .= "
			<form method='POST'>
			<div id='posts'>
			<div id='post'><h3>Inlägg ".$messageID."</h3></div>
			<div id='editpost'>Topic: <input type='text' name='". $post->gettopic(). "' size='15' /><br /><h4>".$post->gettopic()."</h4></div>
			<div id='editpost'>Text: <input type='text' name='". $post->gettxt(). "' size='15' /><p>".$post->gettxt()."</p></div>
			<p><input type='hidden' value='".$messageID."' name='" . $this -> saveEdit . "'/>
			<input type='submit' value='Save'/></form></p>
			</div>
			</form>
			";
		}
		
		return $ret;
	}
	